<ul class="layui-nav " lay-filter="mainmenu">
    @foreach($menudata as $item)
        @if(isset($item['sub']) && empty($item['sub']))
            @if(Entrust::can($item['slug']))

                <li class="layui-nav-item" data-pid="{{$item['code']}}">
                    <a href="javascript:;">
                        <i class="yjs-icon">{{$item['iconfont']}}</i>
                        <cite>{{$item['name']}}</cite>
                        {{--<span class="layui-badge">9</span>--}}
                    </a>
                </li>
            @endif

        @else
            @if(Entrust::can($item['slug']))
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <i class="yjs-icon">{{$item['iconfont']}}</i>
                        <cite>{{$item['name']}}</cite>
                    </a>
                    <dl class="layui-nav-child">
                        @foreach($item['sub'] as $subitem)
                            @if(Entrust::can($item['slug']))
                                <dd data-pid="{{$subitem['code']}}">
                                    <a href="javascript:;">
                                        <i class="yjs-icon">{{$subitem['iconfont']}}</i>
                                        <cite>{{$subitem['name']}}</cite>
                                    </a>
                                </dd>
                            @endif
                        @endforeach
                    </dl>
                </li>
            @endif
        @endif
    @endforeach
</ul>

<ul class="layui-nav layui-layout-right" lay-filter="mainmenu">
    <li class="layui-nav-item layui-this">
        <div class="yjs-user-photo" id="dashAvatar">
            <img src="{{$logindata['avatar']}}"  alt="{{$logindata['name']}}"/>
            {{$logindata['name']}}
        </div>
        <p></p>
        <dl class="layui-nav-child">
            <button class="layui-btn"  id="btnLogout">
                <i class="yjs-icon">&#xe656;</i>
                <cite>退出</cite>
            </button>
            {{--<dd><a href="">退出</a></dd>--}}
        </dl>
    </li>
</ul>

<style>
    .layui-layout-right {
        margin-right: 20px;
    }
    .yjs-user-photo img{
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }
</style>